\section{Memory Management}

\subsection{More On the Page Table}

\begin{frame}
  \frametitle{A bug found recently}
  The mechanism used to set the bits in the page table has been discussed in detail in the mid-term slide.

  \vspace{15pt}

  However, it is found recently that there's a problem. Suppose a page with full permission has been written (so Accessed bit and Dirty bit are all set) and is now being scanned by kswapd, the Accessed bit will be reset while Dirty bit keeps the same. For x86, once the page is read or write again, the Accessed bit will be set immediately, while for umUcore, as the page is mapped as writable (because of the Dirty bit), that bit will never be touched.

  \vspace{15pt}
  Swap may act wrongly in umUcore because of the bug.
\end{frame}

\begin{frame}
  \frametitle{Solution}
  Make the page writable only when both Accessed bit and Dirty bit are set.
\end{frame}